<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/view/conf/farmtag.tld" prefix="PF"%>
<%@ taglib uri="/view/conf/wda.tld" prefix="WDA"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<div class="row">
	<c:forEach var="node" items="${DOCE.files}">
		<c:if test="${fn:length(DOCE.files)==1}">
			<WDA:IsSupport fileid="${node.id}">
				<c:set value="true" var="showifrmae"></c:set>
				<!-- 当只有一个可预览的文件时显示 -->
				<div class="col-md-12 hidden-xs" style="text-align: center;">
					<div class="panel panel-default">
						<div class="panel-footer">
							<iframe style="width: 100%; height: 600px; border: 0px;"
								src="<WDA:DocWebViewUrl fileid="${node.id}" docid="${DOCE.doc.id}"></WDA:DocWebViewUrl>">
							</iframe>
							<div style="overflow: hidden; height: 20px;">
								<span style="color: #666;">${node.len/1000}kb</span>&nbsp;&nbsp;&nbsp;&nbsp;
								<a href="webdoc/view/PubFile${node.id}.html?docid=${DOCE.doc.id}"><span
									class="glyphicon glyphicon-info-sign"></span></a>
								<WDA:IsNotSupport fileid="${node.id}">
									<a class="downloadButton_wcp" href="${node.url}"><span
										class="glyphicon glyphicon-download-alt"></span></a>
								</WDA:IsNotSupport>
								<WDA:IsSupport fileid="${node.id}">
									<PF:IfParameterEquals key="config.sys.webfile.downloadable"
										val="true">
										<a class="downloadButton_wcp" href="${node.url}"><span
											class="glyphicon glyphicon-download-alt"></span></a>
									</PF:IfParameterEquals>
									<a
										target="<PF:ParameterValue key="config.sys.link.newwindow.target"/>"
										href="<WDA:DocWebViewUrl fileid="${node.id}" docid="${DOCE.doc.id}"></WDA:DocWebViewUrl>">
										<span class="glyphicon glyphicon-eye-open"></span>
									</a>
								</WDA:IsSupport>
							</div>
						</div>
					</div>
				</div>
			</WDA:IsSupport>
		</c:if>
		<c:if test="${fn:length(DOCE.files)==1}">
			<div class="col-md-4"></div>
		</c:if>
		<c:if test="${fn:length(DOCE.files)==2}">
			<div class="col-md-2"></div>
		</c:if>
		<!-- 如果iframe不显示则显示图标，如果iframe显示则，只有最小屏幕时才显示图标 -->
		<c:if test="${!showifrmae}"><div class="col-md-4"> </c:if>
		<c:if test="${showifrmae}"><div class="col-md-4 hidden-sm hidden-md hidden-lg"> </c:if>
			<div class="panel panel-default">
				<div class="panel-body" style="padding-bottom: 4px;">
					<div style="height: 128px;">
						<a href="webdoc/view/PubFile${node.id}.html?docid=${DOCE.doc.id}">
							<c:if
								test="${fn:toUpperCase(fn:replace(node.exname,'.',''))=='PNG'||fn:toUpperCase(fn:replace(node.exname,'.',''))=='JPG'||fn:toUpperCase(fn:replace(node.exname,'.',''))=='JPEG'||fn:toUpperCase(fn:replace(node.exname,'.',''))=='GIF'}">
								<img style="max-height: 100%; max-width: 100%;" alt="${node}"
									src="${node.url}" />
							</c:if> <c:if
								test="${fn:toUpperCase(fn:replace(node.exname,'.',''))!='PNG'&&fn:toUpperCase(fn:replace(node.exname,'.',''))!='JPG'&&fn:toUpperCase(fn:replace(node.exname,'.',''))!='JPEG'&&fn:toUpperCase(fn:replace(node.exname,'.',''))!='GIF'}">
								<img style="max-height: 128px; max-width: 128px;" alt="${node}"
									src="text/img/fileicon/${fn:toUpperCase(fn:replace(node.exname,'.',''))}.png" />
							</c:if>
						</a>
					</div>
					<div
						style="white-space: nowrap; color: #666; overflow: hidden; text-overflow: ellipsis;">
						${node.name}</div>
				</div>
				<div class="panel-footer">
					<div style="overflow: hidden; height: 20px;">
						<span style="color: #666;">${node.len/1000}kb</span>&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="webdoc/view/PubFile${node.id}.html?docid=${DOCE.doc.id}"><span
							class="glyphicon glyphicon-info-sign"></span></a>
						<WDA:IsNotSupport fileid="${node.id}">
							<a class="downloadButton_wcp" href="${node.url}"><span
								class="glyphicon glyphicon-download-alt"></span></a>
						</WDA:IsNotSupport>
						<WDA:IsSupport fileid="${node.id}">
							<PF:IfParameterEquals key="config.sys.webfile.downloadable"
								val="true">
								<a class="downloadButton_wcp" href="${node.url}"><span
									class="glyphicon glyphicon-download-alt"></span></a>
							</PF:IfParameterEquals>
							<a
								target="<PF:ParameterValue key="config.sys.link.newwindow.target"/>"
								href="<WDA:DocWebViewUrl fileid="${node.id}" docid="${DOCE.doc.id}"></WDA:DocWebViewUrl>">
								<span class="glyphicon glyphicon-eye-open"></span>
							</a>
						</WDA:IsSupport>
					</div>
				</div>
			</div>
		</div>
		<c:if test="${fn:length(DOCE.files)==2}">
			<div class="col-md-2"></div>
		</c:if>
	</c:forEach>
</div>
<script type="text/javascript">
	$(function() {
		if (is_weixin()) {
			$('.downloadButton_wcp').hide();
		}
	});
	function is_weixin() {
		var ua = navigator.userAgent.toLowerCase();
		if (ua.match(/MicroMessenger/i) == "micromessenger") {
			return true;
		} else {
			return false;
		}
	}
</script>